import re

str1 = "abc123456efg"
print(str1[3:9])

# \d 表示匹配数字
# \w 表示匹配字母或数字
# [a-z] 表示 匹配 小写字母 从a到z
tmp = re.match(r"([a-z]*)(\d*)([a-z]*)", str1)
print(tmp.group(3))

str2 = "abc123efg456hijk"

# 括号表示分组
rule = r"([a-z]*)(\d*)([a-z]*)(\d*)([a-z]*)"

reObject = re.match(rule, str2)
print(reObject.group(2), reObject.group(4))

str3 = 'fetchJSON_comment98({"productAttr":null,"productCommentSummary":1});'

rule2 = r"(.*[(])({.*})([)];)"
reObject2 = re.match(rule2, str3)
print(reObject2)
print(reObject2.group(1))
print(reObject2.group(2))
print(reObject2.group(3))
